# encoding=utf-8
# author:梁子龙
import json
from datetime import datetime, timedelta

from celery.schedules import schedule
from django_celery_beat.models import PeriodicTask

PeriodicTask.objects.create(
    interval=schedule,  # we created this above.
    name='Importing contacts',  # simply describes this periodic task.
    task='proj.tasks.import_contacts',  # name of task.
    args=json.dumps(['arg1', 'arg2']),
    kwargs=json.dumps({
        'be_careful': True,
    }),
    expires=datetime.utcnow() + timedelta(seconds=30)
)


from django_celery_beat.models import CrontabSchedule, PeriodicTask
schedule, _ = CrontabSchedule.objects.get_or_create(
     minute='30',
     hour='*',
     day_of_week='*',
     day_of_month='*',
     month_of_year='*',
     timezone=zoneinfo.ZoneInfo('Canada/Pacific')
)